<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>文本框</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
    <meta name="generator" content="www.leipi.org" />
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.css">
    <!--[if lte IE 6]>
    <link rel="stylesheet" type="text/css" href="bootstrap/bootstrap-ie6.css">
    <![endif]-->
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="css/ie.css">
    <![endif]-->
    <link rel="stylesheet" href="../css/style.css">
    <script type="text/javascript" src="../js/internal.js"></script>
    <script type="text/javascript" src="../js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript">
/* Thank you by  
http://www.alt-tag.com/blog/2006/02/ie-dom-bugs/ */
function createElement(type, name)
{     alert(type);
    var element = null;     
    try {        
        element = document.createElement('<'+type+' name="'+name+'">');     
    } catch (e) {}   
    if(element==null) {     
        element = document.createElement(type);     
        element.name = name;     
    } 
    console.log(element);
    return element;     
}
    </script>
</head>
<body>
<div class="content">
    <table class="table table-bordered table-striped table-hover">
     <tr>
        <th><span>列数 </span><span class="label label-important">*</span></th>
        <th><span>默认值 </span> </th>
    </tr>
    <tr>
        <!-- <td><input type="text" id="orgname" placeholder="必填项"></td> -->
        <td>
	       <span leipiplugins="radios" title="a" name="leipiNewField" class="g_ridios">
	       <input type="radio" name="leipiNewField" value="1" checked />1&nbsp;
	       <input type="radio" name="leipiNewField" value="2"  />2&nbsp;
	       <input type="radio" name="leipiNewField" value="3"  />3&nbsp;
	       </span>
        </td>
        <td><input type="text" id="orgvalue" placeholder="无则不填"></td>
    </tr>
    <tr>
        <th><span>数据类型</span> </th>
        <th><span>对齐方式</span> </th>
    </tr>
    <tr>
        <td>
             <select id="orgtype">
                <option value="text">普通文本</option>
                <option value="email">邮箱地址</option>
                <option value="int">整数</option>
                <option value="float">小数</option>
                <option value="idcard">身份证号码</option>
            </select>   
        </td>
        <td>
            <select id="orgalign">
                <option value="left" >左对齐</option>
                <option value="center">居中对齐</option>
                <option value="right">右对齐</option>
            </select>
        </td>
    </tr>
    <tr>
        <th><span>&nbsp;&nbsp;&nbsp;&nbsp;长&nbsp;&nbsp;X&nbsp;&nbsp;宽&nbsp;&nbsp;&nbsp;&&nbsp;&nbsp;&nbsp;字体大小</span> </th>
        <th><span>可见性</span> </th>
    </tr>
    <tr>
        <td>
            <input id="orgwidth" type="text" value="150" class="input-small span1" placeholder="auto"/>
            X
            <input id="orgheight" type="text" value="" class="input-small span1" placeholder="auto"/>
            &
            <input id="orgfontsize" type="text"  value="" class="input-small span1" placeholder="auto"/> px

        </td>
        <td>
            <label class="checkbox inline"><input id="orghide" type="checkbox"/> 隐藏 </label>
        </td>
    </tr>

    </table>
</div>
<script type="text/javascript">
var oNode = null,thePlugins = 'text';
window.onload = function() {
    if( UE.plugins[thePlugins].editdom ){
        oNode = UE.plugins[thePlugins].editdom;
		var gValue = oNode.getAttribute('value').replace(/&quot;/g,"\""),gTitle=oNode.getAttribute('title').replace(/&quot;/g,"\""),gHidden=oNode.getAttribute('orghide'),gFontSize=oNode.getAttribute('orgfontsize'),gAlign=oNode.getAttribute('orgalign'),gWidth=oNode.getAttribute('orgwidth'),gHeight=oNode.getAttribute('orgheight'),gType=oNode.getAttribute('orgtype');
	
		gValue = gValue==null ? '' : gValue;
        gTitle = gTitle==null ? '' : gTitle;
		$G('orgvalue').value = gValue;
        //$G('orgname').value = gTitle;
        if (gHidden == '1')
        {
            $G('orghide').checked = true;
        }
        $G('orgfontsize').value = gFontSize;
        $G('orgwidth').value = gWidth;
        $G('orgheight').value = gHeight;
        $G('orgalign').value = gAlign;
        $G('orgtype').value = gType;
    }
}
dialog.oncancel = function () {
    if( UE.plugins[thePlugins].editdom ) {
        delete UE.plugins[thePlugins].editdom;
    }
};
dialog.onok = function (){
	
    /*
	if($G('orgname').value==''){
	console.log('请输入控件名称');
    alert('请输入控件名称');
    return false;
   }
    */
    var gValue=$G('orgvalue').value.replace(/\"/g,"&quot;"),gFontSize=$G('orgfontsize').value,gAlign=$G('orgalign').value,gWidth=$G('orgwidth').value,gHeight=$G('orgheight').value,gType=$G('orgtype').value;
    
    
    var num=$('input:radio[name=leipiNewField]:checked').val();
	//alert(num);
	var html="";
	var tdhtml="";
	var td="";
	if(num!="0"){
		for(var i=0;i<num;i++){
			tdhtml='<tr class="firstRow" style="background:blue;border:1px solid red;width:80px;height:30px;"></th ></th></td ></td></tr>';
            td+=tdhtml;
		}
		tdhtml=td;
		//console.log(tdhtml);

	}
    if( !oNode ) {
        try {       
        	oNode = createElement('table','leipiNewField');
        	html=' <div class="col-lg-12 col-md-12 col-sm-12" style="border:1px solid red;">';
        	html+='<div class="table-responsive">';
        	html+='<table class="eiac-listTable">';
        	html+='<tbody>';
        	html+=tdhtml;
        	html+='</tbody>';
        	html+='</table>';
        	html+='</div>';
        	html+='</div>';
        	 //html=tdhtml;
        	 console.log(html);
             //console.log(oNode.outerHTML);
            //editor.execCommand('insertHtml',oNode.outerHTML);
            editor.execCommand('insertHtml',html);
        } catch (e) {
            try {
                editor.execCommand('error');
            } catch ( e ) {
                alert('控件异常，请到 [雷劈网] 反馈或寻求帮助！');
            }
            return false;
        }
    } else {
        console.log("这里====走了======");
      
        delete UE.plugins[thePlugins].editdom;
    }
};
</script>
</body>
</html>